package cn.tedu.testfile;
/**
 * @Author 金帮嘉诚  @Date 2021-06-17 周四 20:38
 */
/*本类用于测试读取文本中字符*/

import java.io.*;

/**
 * 知识点：
 */
public class TestRead {
    public static void main(String[] args) {
        method1();
        method2();
    }

    private static void method2() {
        BufferedReader in = null;

        try {
//            in=new BufferedReader(new FileReader(new File("D:\\ready\\1.txt")));
            in = new BufferedReader(new FileReader("D:\\ready\\8.txt"));

            String b = null;
            while ((b = in.readLine()) != null) {
                System.out.println(b);

            }


        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    private static void method1() {

    }
}

